from fastapi import APIRouter, Depends
from services.item_service import ItemService
from repositories.item_repository import ItemRepository

# 依赖注入
from dependencies import get_item_service

# 创建路由器
router = APIRouter(
    prefix="/categories",
    tags=["分类管理"],
    responses={404: {"description": "未找到"}}
)

@router.get(
    "",
    summary="获取所有分类",
    description="获取系统中所有商品分类列表"
)
async def get_categories(
    service: ItemService = Depends(get_item_service)
):
    """获取所有商品分类"""
    return service.get_categories() 